package com.sdk.springbootrediscache.redistemplate;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/redis")
public class RedisController {

    @Autowired
    private RedisService redisService;

    @PostMapping("/set")
    public String setData(@RequestParam String key, @RequestParam String value) {
        redisService.set(key, value);
        return "Data set successfully";
    }

    @GetMapping("/get")
    public Object getData(@RequestParam String key) {
        return redisService.get(key);
    }

    @DeleteMapping("/delete")
    public String deleteData(@RequestParam String key) {
        redisService.delete(key);
        return "Data deleted successfully";
    }
}
